<?php

class DB {
	static $dbs = array();

	static function getConnection($DB) {
		if(empty(self::$dbs[$DB])) {
			self::$dbs[$DB] = new PDO('mysql:host=localhost;dbname='. $DB,
								'root',
								'',
								array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
		}
		
		return self::$dbs[$DB];
	}

	static function getStatement($query, $DB) {
		return self::getConnection($DB)->prepare($query);
	}
}

?>